﻿//////////////////////////////////////////////////////////////////////////////////////
///// Loading.cs                                                         /////
///// 로딩화면                                                            /////
//////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace Pyramid_Game
{
    class Loading : GameScreen
    {
        #region Declarations
        
        Texture2D load;
        double loadingTime;

        #endregion

        #region Load

        public Loading() { }
        public override void LoadContent(ContentManager content)
        {
            load = content.Load<Texture2D>("Texture/load");
        }

        #endregion

        #region Update & Draw
        
        public override void Update(Touch touch, GameTime gameTime)
        {
            if (GameConstants.IsLoading)
            {
                loadingTime = gameTime.TotalGameTime.TotalSeconds;
                GameConstants.IsLoading = false;
            }
            else if(loadingTime + 3 < gameTime.TotalGameTime.TotalSeconds)
            {
                ScreenManager.AddScreen(new Background());
                ScreenManager.RemoveScreen(this);
            }
        }
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spriteBatch.Draw(load, Vector2.Zero, Color.White);
        }

        #endregion
    }
}
